<template>
	<view class="content">
		<u-navbar bgColor="transparent" titleStyle="color:#fff" title="开奖记录" leftIconColor="#fff" :autoBack="true"
			:placeholder="false">
		</u-navbar>
		<view style="height: 6vh;"></view>
		<view class="box">
			<view class="item" v-for="(item,index) in list" :key="index">
				<image src="/static/my/my_head.png" mode=""></image>
				<view class="item-right">
					<view class="item-info">
						<view class="name">
							{{item.name}}
						</view>
						<view class="date">
							{{item.message}}
						</view>
						<view class="date">
							{{item.time}}
						</view>
					</view>
					<view class="item-record">
						<view class="num" v-if="item.status =='555'">
							+{{item.num}}云矿石
						</view>
						<view class="num" v-else>
							-{{item.num}}云矿石
						</view>
						<view class="status" v-if="item.status =='555'">
							搏杀成功
						</view>
						<view class="status fail" v-else>
							搏杀失败
						</view>
					</view>
				</view>
			</view>
			<u-loadmore :status="status" />
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list: [],
				page: 1,
				status: 'loadmore',
			}
		},
		onLoad() {
			this.postlist()
		},
		onReachBottom() {
			this.page++
			this.status = 'loading';
			this.postlist()
		},
		methods: {
			postlist() {
				let params = {
					page: this.page,
				}
				this.$Request({
					method: 'POST',
					url: '/api/luckys/pinlog',
					data: params
				}).then(res => {
					if (res.code == 1) {
						console.log(res)
						if (res.data.list.length < 10) {
							this.status = 'nomore';
						}
						if (this.page == 1) {
							this.list = res.data.list
						} else {
							this.list = [...this.list, ...res.data.list]
						}
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background: #17191A;
	}
</style>
<style lang="scss" scoped>
	.content {
		min-height: 100vh;
		background-image: url('../../../static/my/my-bg.png');
		background-repeat: no-repeat;
		background-size: 100% 544rpx;

		.box {
			padding: 30rpx;

			.item {
				display: flex;
				align-items: center;
				color: #fff;
				padding: 30rpx;
				border-radius: 20rpx;
				background: linear-gradient( 134deg, rgba(255,227,211,0.06) 0%, rgba(67,130,84,0.26) 100%);
				border: 4rpx solid rgba(108,233,137,0.12);
				margin-bottom: 30rpx;

				image {
					width: 82rpx;
					height: 82rpx;
					margin-right: 20rpx;
				}

				.item-right {
					width: 90%;
					display: flex;
					align-items: center;
					justify-content: space-between;

					.item-info {
						.name {
							font-size: 28rpx;
							font-weight: 600;
						}

						.date {
							font-size: 24rpx;
							color: #ececec;
							margin-top: 10rpx;
						}
					}

					.item-record {
						.num {
							font-size: 28rpx;
							font-weight: 600;
							color: #F53CDE;
						}

						.status {
							color: #2EBDA6;
							font-size: 24rpx;
							margin-top: 10rpx;
						}

						.fail {
							color: #FF5757;
						}
					}
				}
			}
		}
	}
</style>